package com.bigData.main.controller;


import com.bigData.main.pojo.UserInfo;
import com.bigData.main.service.UserRegisterService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class UserRegisterController {
    @Resource
    UserRegisterService userRegisterService;

    @RequestMapping("/new/insertUser")
    public Integer insertUser(UserInfo u) {
        return userRegisterService.insertUserInfo(u);
    }

    @RequestMapping("/new/updateUser")
    public Integer updateUser(UserInfo u) {
        return userRegisterService.updateUserInfo(u);
    }

//    @RequestMapping("/new/updateRoot")
//    public Integer updateRoot(userinfo u){
//        return  use.updateRootInfo(u);
//    }

    @RequestMapping("/new/deleteUser")
    public Integer deleteUser(UserInfo u) {
        return userRegisterService.deleteUserInfo(u);
    }

    @RequestMapping("/new/insertRoot")
    public Integer insertRoot(UserInfo u) {
        return userRegisterService.insertRootInfo(u);
    }

    @RequestMapping("/new/zhuceuser")
    public Integer zhuce(UserInfo u) {
        return userRegisterService.getUserName(u);
    }

    @RequestMapping("/new/zhuceroot")
    public Integer zhuceroot(UserInfo u) {
        return userRegisterService.getRootName(u);
    }

    @RequestMapping("/new/countuser")
    public List<UserInfo> user(UserInfo u) {
        return userRegisterService.user();
    }

    @RequestMapping("/new/uroot")
    public Integer uroot(UserInfo u) {
        return userRegisterService.uroot(u);
    }
}
